package elementui.script;

import elementui.form.Autocomplate;
import elementui.form.Input;

public class Test {

    public static void main(String[] argc)
    {
        ScriptContainer sc = new ScriptContainer();

        sc.setData("data() {\n" +
                "      return {\n" +
                "        restaurants: [],\n" +
                "        state1: '',\n" +
                "        state2: '',\n" +
                "input: '' "+
                "      };\n" +
                "    }");
        System.out.println("hi");
        Input input = new Input();
        input.setIcon("el-icon-date");
        input.setPlaceholder("请输入内容");


        input.setScript("querySearch(queryString, cb) {\n" +
                "        var restaurants = this.restaurants;\n" +
                "        var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;\n" +
                "        // 调用 callback 返回建议列表的数据\n" +
                "        cb(results);\n" +
                "      }");
        sc.addMethod(input.toString(),input.getScript());
        sc.addMounted(input.toString(),"this.restaurants = this.loadAll();");


        Autocomplate autocomplete = new Autocomplate();
       // autocomplete.setScript();
        sc.addMethod(autocomplete.toString(),autocomplete.getScript());

        sc.addHtml(input.getDefaultHmtl());
        sc.addHtml(autocomplete.getDefaultHmtl());

        System.out.println(input.getDefaultHmtl());

        System.out.println(sc.htmls);

        System.out.println(sc.getDefaultScriptContainer());

    }
}
